package com.lc.railway.ui.activity;

import android.view.LayoutInflater;
import android.widget.FrameLayout;

import com.gyf.immersionbar.ImmersionBar;
import com.lc.railway.R;
import com.lc.railway.app.AppActivity;
import com.lc.railway.other.IntentKey;
import com.lc.railway.util.SPUtil;
import com.lc.railway.widget.WaterMarkView;

abstract public class WaterActivity extends AppActivity {

    private WaterMarkView waterMarkView;

    @Override
    protected void initLayout() {
        if (getLayoutId() > 0) {
            setContentView(R.layout.activity_app);
            FrameLayout frameLayout = (FrameLayout) findViewById(R.id.fl_container);
            waterMarkView = (WaterMarkView) findViewById(R.id.wmv);
            frameLayout.addView(LayoutInflater.from(this).inflate(getLayoutId(), frameLayout, false));
            initSoftKeyboard();
        }

        if (getTitleBar() != null) {
            getTitleBar().setOnTitleBarListener(this);
        }

        // 初始化沉浸式状态栏
        if (isStatusBarEnabled()) {
            getStatusBarConfig().init();

            // 设置标题栏沉浸
            if (getTitleBar() != null) {
                ImmersionBar.setTitleBar(this, getTitleBar());
            }
        }

    }

    @Override
    protected void onStart() {
        super.onStart();
        String text = SPUtil.get(getContext(), IntentKey.NAME, "") + SPUtil.get(getContext(), IntentKey.PHONE, "");
        if (text != null) {

            waterMarkView.setParams(text);
        }
    }
}
